package pl.edu.szlif.mosm.commonlib;

public class MathSupplement {
	static public double log10(double a) {
		double res = 0.0f;

		while (a < 1) {
			res -= 1;
			a *= 10.0;
		}
		while (a >= 10) {
			res += 1;
			a /= 10.0f;
		}

		double partial = 1.0f;
		while (partial >= 10e-13) {
			partial /= 2.0f;
			a *= a;
			if (a >= 10) {
				a /= 10.0f;
				res += partial;
			}
		}
		return res;
	}
	
	static public int pow2(int factor){
		return 1<<factor;
	}
}
